import 'package:flutter/material.dart';

class RightSliderPageRoute extends PageRouteBuilder {

  final Widget widget;

  RightSliderPageRoute(this.widget)
  : super (
      transitionDuration: const Duration(milliseconds: 300),
      pageBuilder: (
          BuildContext context,
          Animation<double> animation1,
          Animation<double> animation2){
        return widget;
      },
      transitionsBuilder: (
          BuildContext context,
          Animation<double> animation1,
          Animation<double> animation2,
          Widget child
          ){
        return SlideTransition(
          position: Tween<Offset>(
              begin: Offset(1.0, 0.0),
              end: Offset(0.0, 0.0)
          )
              .animate(CurvedAnimation(parent: animation1, curve: Curves.easeOutQuad)),
          child: child,
        );
      }
  );

}